function jsApiCall(data,status) {
	//let return_url = data.return_url;
	//let detail_id = data.detail_id;
   WeixinJSBridge.invoke(
      // 'getBrandWCPayRequest',
      'getBrandWCPayRequest', {
      		// "provider": 'wxpay',
         "appId": data.appId,     //公众号ID，由商户传入     
      	 "timeStamp": data.timeStamp,         //时间戳，自1970年以来的秒数     
      	 "nonceStr": data.nonceStr, //随机串     
      	 "package": data.package,     
      	 "signType": data.signType,         //微信签名方式：     
      	 "paySign": data.paySign //微信签名 }, //公众号名称，由商户传入     
        },
      function(res){
         WeixinJSBridge.log(res.err_msg);
         if(res.err_msg == "get_brand_wcpay_request:ok" ) {
			uni.redirectTo({
				url:'/pages/index/pay/pay?status='+status+'&order_sn='+data.order_sn+'&pay_price='+data.pay_price
			})
         }else{
			 uni.navigateBack({
			 	delta:1
			 })
         }
      }
   );
}

export function callpay(data,status)
{
	//alert('aa');
   if (typeof WeixinJSBridge == "undefined"){
       if( document.addEventListener ){
           document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
       }else if (document.attachEvent){
           document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
           document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
       }
   }else{
       jsApiCall(data,status);
   }
}